package org.idea.qiyu.framework.rpc.dubbo.filter;

import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author linhao
 * @Date created in 10:54 下午 2021/7/31
 */
@Activate(group = {CommonConstants.CONSUMER}, order = -100000)
public class ConsumerContextFilter implements Filter {

    private static final Logger LOGGER = LoggerFactory.getLogger(ConsumerContextFilter.class);

    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        System.out.println("this is consumer");
        LOGGER.info("url is {}", invocation.getInvoker().getUrl());
        return invoker.invoke(invocation);
    }
}
